<template>
  <div class="sigin-in-subscribe-information">
    <c-title text="实名认证"></c-title>
    <main class="main">
      <div class="box">
        <van-cell-group>
          <van-field v-model="form.name" label="真实姓名" placeholder="请输入真实姓名" />
          <van-field v-model="form.number" label="身份证号" placeholder="请输入身份证号" />
        </van-cell-group>
      </div>
    </main>
    <div class="btn">
      <van-button color="#F51D1D" @click="confirm">确定</van-button>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      form: {
        name: "",
        number: ""
      }
    };
  },
  activated() {
    this.getData();
  },
  methods: {
    async getData() {
      let { result, msg, data } = await $http.get("plugin.sign-buy.frontend.sign-buy-app.user-info",{},".");
      if (result == 0) return this.$toast(msg);
      this.form.name = data.real_name;
      this.form.number = data.identity_card;

    },
    async confirm() {
      let { result, msg } = await $http.post("plugin.sign-buy.frontend.sign-buy-app.store-user-info", { real_name: this.form.name, identity_card: this.form.number },'.');
      this.$toast(msg);
      if (result == 1) {
        this.gotoUrl('sigin_in_subscribe_app');
      }
    },
    gotoUrl(name, params = {}, query={}) {
      this.$router.push(this.fun.getUrl(name, params,query));
    },
  }
};
</script>

<style scoped lang="scss">
::v-deep .van-button {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0.3125rem;
}

.sigin-in-subscribe-information {
  height: 100vh;
  width: 100%;
  position: relative;

  .btn {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3.125rem;
    padding: 0.3125rem 1.7188rem;
    background: #fff;
  }

  .main {
    padding: 0.625rem;
  }

  .box {
    background: #fff;
  }
}
</style>
